﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace="FT.Architecture.Example.Core.Entities.Pets" assembly="FT.Architecture.Example.Core">
  <class name="FT.Architecture.Example.Core.Entities.Pets.IPet" table="pet">
    <cache usage ="nonstrict-read-write"/>

    <id name="Id" column="ID_Pet" unsaved-value="0">
      <generator class="hilo">
        <param name="table">aa_hi_lo</param>
        <param name="column">next_value</param>
        <param name="max_lo">99</param>
      </generator>
    </id>

    <discriminator type="string" column="type"></discriminator>

    <subclass name="PetBase">

      <property name="Name" index="Index_Pet_Name" />

      <many-to-one name="BorrowedBy" column="ID_BorrowedBy" class="FT.Architecture.Example.Core.Entities.Humans.IHuman" foreign-key="FK_Pet_BorrowedBy"></many-to-one>

      <set name="Owners" table="human_pet" access="field.camelcase" inverse="true">
        <key column="ID_Pet"></key>
        <many-to-many class="FT.Architecture.Example.Core.Entities.Humans.IHuman" column="ID_Human"></many-to-many>
      </set>

      <subclass name="Dog" discriminator-value="dog"></subclass>
      <subclass name="Cat" discriminator-value="cat"></subclass>

    </subclass>
    
    

  </class>
</hibernate-mapping>